package cn.hsw.component.core.dto;

import cn.hsw.component.core.base.BaseConstant;
import cn.hsw.component.core.enums.HttpEnum;
import cn.hsw.component.core.util.Validator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 接口响应数据
 * @author 李子木
 */
@Data
@ApiModel("接口响应数据模型")
public class ResultDto<T> {

    @ApiModelProperty("响应码200成功,其它失败时msg有说明")
    private Integer code;

    @ApiModelProperty("提示信息")
    private String msg;
    @ApiModelProperty("响应数据")
    private T data;
    @ApiModelProperty("boolean型响应码")
    public boolean isSuccess(){
        return Validator.equal(code, HttpEnum.SUCCESS.getCode());
    }
}
